Trilium has always supported Markdown through its import feature, however the file was either transformed to a Text note (converted to Trilium's internal HTML format) or saved as a Code note with only syntax highlight.

This note type is a split view, meaning that both the source code and a preview of the document are displayed side-by-side. See Note types with split view for more information.

Rationale

The goal of this note type is to fill a gap: rendering Markdown but not altering its structure or its whitespace which would inevitably change otherwise through import/export.

Even if Markdown is now specially treated by having a preview mechanism, Trilium remains at its core a WYSWYG editor so Markdown will not replace text notes.

Features

Source view pane

Preview pane

The following features are supported by Trilium's Markdown format and will show up in the preview pane:

Links

Multiple types of links are supported:

To create a link, either:

Link Previews are also rendered, but there is no mechanism to insert them automatically as of now, they have to be copied from a Text note instead.

Keyboard shortcuts

The Markdown notes share some of the keyboard shortcuts from Text notes:

In addition, the following formatting keyboard shortcuts are available:

Images & attachments

Images can be inserted into the document in four different methods:

An image reference to an attachment looks like this:

![Name.jpeg](api/attachments/z50RceuHXe9J/image/image)

Auto-completion

Slash commands

Just like Text notes, Markdown notes support a selection of slash commands:

Note that slash commands only work outside of code blocks and inline code.

Code block language auto-completion

Starting with v0.104.0, typing ``` to insert a code block will automatically open a list of suggested language types which have syntax highlighting.

The list of languages matches the one for Code notes set in Options, it's not the full list of languages supported by Trilium.

Other features

Shared notes

When a Markdown note is shared publicly, it will be rendered with extended formatting just like Text notes.

Most of the features described previously should be supported. If you face any issues, feel free to report it alongside a sample Markdown file.

Creating Markdown notes

There are two ways to create a Markdown note:

  1. Create a new note (e.g. in the Note Tree) and select the type Markdown, just like all the other note types.
  2. Create a note of type Code and select as the language either Markdown or GitHub-Flavored Markdown. This maintains compatibility with your existing notes prior to the introduction of this feature.

Import/export

Import

By default, when importing a single Markdown file it automatically gets converted to a Text note. To avoid that and have it imported as a Markdown note instead:

When importing a Trilium ZIP, it will preserve the Markdown type without converting to text notes thanks to the meta-information in it.

Exporting

When exporting Markdown files, the extension is preserved and the content remains the same as in the source view (with some small exceptions such as handling of attachments).

When exporting Markdown files as ZIP, choosing HTML or Markdown as the export format makes no difference as that only affects Text notes.

If the Markdown note contains attachments, a ZIP export will rewrite the links to attachments so that they are replaced with a relative path to the attachment. On import, the links are re-written back.

Conversion between text notes and Markdown notes

Text notes can be converted into Markdown notes and vice versa. See Converting between note types.

Sync-scrolling & block highlight

When scrolling through the editing pane, the preview pane will attempt to synchronize its position to make it easier to see the preview.

In addition, the block in the preview matching the position of the cursor in the source view will appear slightly highlighted.

The sync is currently one-way only, scrolling the preview will not synchronize the position of the editor.

This feature cannot be disabled as of now; if the scrolling feels distracting, consider temporarily switching to the editor mode and then switching to preview mode when ready.